package com.atguigu.yygh.oss.controller;

import com.atguigu.yygh.oss.service.FileService;
import com.atguigu.yygh.result.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author zr
 * @date 2021/12/17 20:31
 */
@Api(tags = "文件上传Api")
@RestController
@RequestMapping("/api/oss/file")
public class FileApiController {
    @Resource
    private FileService fileService;

    @PostMapping("fileUpload")
    public Result uploadOssFiles(MultipartFile file) {
        String url =fileService.upload(file);
        return Result.ok(url);
    }
}
